package com.junxian.demo02.controller;

import com.junxian.demo02.dao.User;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by admin on 2018/12/5.
 */

@Controller
public class UserController {

    @PostMapping(value = "/user" , consumes = MediaType.APPLICATION_XML_VALUE , produces = MediaType.APPLICATION_XML_VALUE)
    @ResponseBody
    public User user(@RequestBody User user){
        user.setName("My name is " + user.getName());
        user.setAge(100 + user.getAge());
        return user;
    }
}
